package com.situ.mianXiangDuiXiang.tset;

import com.situ.mianXiangDuiXiang.entity.Fish;
import com.situ.mianXiangDuiXiang.entity.JingFish;
import com.situ.mianXiangDuiXiang.entity.几何体;
import com.situ.mianXiangDuiXiang.entity.圆形;
import com.sunni.entity.Admin;
import com.sunni.entity.Borrow;
import com.sunni.repository.BorrowRepository;
import com.sunni.repository.impl.BorrowRepositoryImpl;
import com.sunni.test.test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

public class Test {


    public int hashCode(){
        return 10;
    }
    @org.junit.Test
    public void test02(){
        Test test = new Test();
        Test test2 = new Test();
        System.out.println(test.hashCode());
        System.out.println(new Test().hashCode());
        System.out.println(test2.hashCode());
    }

    @org.junit.Test
    public void test01() {
       BorrowRepository borrowRepository = new BorrowRepositoryImpl();
        for(Borrow borrow:borrowRepository.findAllByReaderid(17,2,6)){
            System.out.println(borrow);
        }

    }

    @org.junit.Test
    public void dataTest(){
        String geshi = "yyyy-MM-dd hh:mm:ss";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(geshi);
        System.out.println(simpleDateFormat.format(new Date()));

        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");//小写的mm表示的是分钟
        String dstr="2021-03-25 14:22:56";
        try {
            Date date=sdf.parse(dstr);
            System.out.println(date);
        } catch (ParseException e) {
            System.out.println(e);
        }

    }

    @org.junit.Test
    public void 集合(){
        HashSet<Integer> hashSet = new HashSet<>();
        boolean isContinue = true;
        while (isContinue){
            hashSet.add(new Random().nextInt(100));
            if (hashSet.size() == 20){
                isContinue = false;
            }
        }
        System.out.println(hashSet);
        System.out.println(hashSet.size());
    }
    @org.junit.Test
    public void List练习(){
        List<Integer> intList = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            intList.add(new Random().nextInt(100));
        }
        System.out.println(intList);

        // 去偶数
        for (int i = 0; i < intList.size(); i++) {
            if (intList.get(i)%2==0){
                intList.remove(i);
            }else {
                continue;
            }

        }
        System.out.println(intList);
    }

    @org.junit.Test
    public void 迭代器(){
        ArrayList<Admin> list01 = new ArrayList<>();
        list01.add(new Admin(1,"五五开","1111"));
        list01.add(new Admin(2,"局座","1111"));

        ArrayList<Admin> list02 = new ArrayList<>();
        list02.add(new Admin(1,"五五开","1111"));
        list02.add(new Admin(3,"李团长","1111"));

        list02.removeAll(list01);


        System.out.println(list02);
    }

}
